<%--
  Created by IntelliJ IDEA.
  User: 我的大名叫陆健伟
  Date: 2016/2/16
  Time: 16:24
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=utf-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<style type="text/css">
    .pageFormContent .fix_p{ float: none}
    .pageFormContent label {
        width: 100px;
        padding: 0 5px;
        line-height: 21px;
        text-align: right;
    }
    .pageFormContent .textInput {
        width: 200px;
    }
    .gray {
        color: gray;
    }
</style>
<div class="pageContent">
    <form id="pagerForm" method="post" action="<c:url value='/movecar/editMoveCar'/>" class="pageForm required-validate"
          onsubmit="return validateCallback(this,callbackForSubmit)" rel="dlg_move_car_edit" >
        <div class="pageFormContent" style="height:400px">
            <p class="fix_p">
                <label for="txt_movecar_carNo">车牌号码</label>
                <input id="txt_movecar_carNo" type="text" name="carNo" readonly  value="${movecar.carNo}"/>
            </p>
            <p class="fix_p">
                <label for="txt_movecar_carTypeId">车牌类型</label>
                <input id="txt_movecar_carTypeId" type="text" name="carTypeId" readonly  value="${movecar.carTypeId}"/>
            </p>
            <%--<p class="fix_p">--%>
            <div>
                <label for="txt_movecar_image">现场图片</label>
                <span id="txt_movecar_image"  style="cursor:pointer;">
                    <img src="<c:url value='${movecar.imageUrl}'/>" width="200" height="200" onclick="showBigImg('${movecar.imageUrl}')"/>
                </span>
            </div>
            <%--</p>--%>
            <p class="fix_p">
                <label for="txt_movecar_carOwner">车主姓名</label>
                <input id="txt_movecar_carOwner" type="text" name="carOwner" readonly  value="${movecar.carOwner}"/>
            </p>
            <p class="fix_p">
                <label for="txt_movecar_ownerMobile">车主联系方式</label>
                <input id="txt_movecar_ownerMobile" type="text" name="ownerMobile" readonly  value="${movecar.ownerMobile}"/>
            </p>
            <p class="fix_p">
                <label for="txt_movecar_address">挪车地址</label>
                <input id="txt_movecar_address" type="text" name="address" readonly  value="${movecar.address}"/>
            </p>
            <p class="fix_p">
                <label for="txt_movecar_reportName">报警人姓名</label>
                <input id="txt_movecar_reportName" type="text" name="reportName" readonly  value="${movecar.reportName}"/>
            </p>
            <p class="fix_p">
                <label for="txt_movecar_reportMobile">报警人联系方式</label>
                <input id="txt_movecar_reportMobile" type="text" name="reportMobile" readonly  value="${movecar.reportMobile}"/>
            </p>
            <p class="fix_p">
                <label for="txt_movecar_reportAddress">报警地址</label>
                <input id="txt_movecar_reportAddress" type="text" name="reportAddress" readonly  value="${movecar.reportAddress}"/>
            </p>
            <p class="fix_p">
                <label for="txt_movecar_hlStatus">处理状态</label>
                <c:if test="${movecar.handleStatus==2}"><input id="txt_movecar_hlStatus" type="text" name="handleStatus" readonly  value="${movecar.handleStatus}"/></c:if>
                <c:if test="${movecar.handleStatus!=2}">
                    <select id="txt_movecar_hlStatus" name="handleStatus" class="combox">
                        <option value="1">未处理</option>
                        <option value="2">已处理</option>
                        <%--<option value="3">无数据</option>--%>
                    </select>
                </c:if>
            </p>
            <p class="fix_p">
                <label for="txt_movecar_reportTime">提交时间</label>
                <input id="txt_movecar_reportTime" type="text" name="reportTime" readonly  value="<fmt:formatDate value='${movecar.reportTime}' pattern='yyyy-MM-dd HH:mm:ss'/> "/>
            </p>
            <p class="fix_p">
                <label for="txt_movecar_handleTime">处理时间</label>
                <input id="txt_movecar_handleTime" type="text" name="handleTime" readonly  value="<fmt:formatDate value='${movecar.handleTime}' pattern='yyyy-MM-dd HH:mm:ss'/> "/>
            </p>
            <p class="fix_p">
                <label for="txt_movecar_handleName">操作员</label>
                <input id="txt_movecar_handleName" type="text" readonly  value="${movecar.handleName}"/>
            </p>
            <p class="fix_p">
                <label for="txt_movecar_handleResult">处理结果</label>
                <c:if test="${movecar.handleStatus==2}">
                    <input id="txt_movecar_handleResult" style="width: 400px" type="text" name="handleResult" readonly  value="${movecar.handleResult}"/>
                </c:if>
                <c:if test="${movecar.handleStatus!=2}">
                    <input id="txt_movecar_handleResult"  style="width: 400px" required type="text" name="handleResult" maxlength="100" value="${movecar.handleResult}"/>
                </c:if>
            </p>
        </div>
        <div class="formBar">
            <ul>
                <li>
                    <c:if test="${movecar.handleStatus==2 }">
                        <div class="button" style="margin: 0 auto">
                            <div class="buttonContent">
                                <button type="button" class="close">返回</button>
                            </div>
                        </div>
                    </c:if>
                    <c:if test="${movecar.handleStatus!=2 }">
                        <div class="buttonActive">
                            <div class="buttonContent">
                                <button type="submit">提交</button>
                            </div>
                        </div>
                    </c:if>
                </li>
            </ul>
        </div>
        <input type="hidden" name="handleName" value="${handleName}">
        <input type="hidden" name="id" value="${movecar.id}">
        <input type="hidden" value="${movecar.handleStatus}" id="handleStatus">
    </form>
</div>
<script>
    $(function(){
        /*var txt=$("#txt_movecar_carOwner").val();
        var newTxt = txt.substring(0,1)+"**";
        $("#txt_movecar_carOwner").val(newTxt);*/
        $("#txt_movecar_hlStatus").val($("#handleStatus").val());
        var status = $("#txt_movecar_hlStatus").val();
        if(status == "2"){
            $("#txt_movecar_hlStatus").val("已处理");
        }else {
            $("#txt_movecar_handleResult").attr("disabled",true);
        }

        $("#txt_movecar_hlStatus").change(function(){
            if(this.value == "1" || this.value == "3"){
                $("#txt_movecar_handleResult").val("");
                $("#txt_movecar_handleResult").attr("disabled",true);
            }else{
                $("#txt_movecar_handleResult").attr("disabled",false);
            }
        });

    });

    function callbackForSubmit(resp, st, xhr) {
        if (resp && resp.succ) {
            alertMsg.info("堵路移车信息更新成功！");
            $.pdialog.closeCurrent();
            navTab.reloadFlag('page_app_list')
        } else {
            alertMsg.info(resp.msg + "!");
        }
    }

    function showBigImg(imgPath){
        window.open(imgPath);
    }
</script>